﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace QuanLyKho.GUI.Library
{

    public class ucFactory
    {
        private UserControl ucInstance = new UserControl();

        public UserControl UcInstance
        {
            get { return ucInstance; }
            set { ucInstance = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="uc"></param>
        /// <returns></returns>
        private static UserControl getInstanceUC(UserControl uc)
        {
            if (uc == null)
            {
                uc = new UserControl();
            }
            return uc;
        }

        /// <summary>
        /// Thiết lập Usercontrol
        /// </summary>
        /// <param name="uc"></param>
        /// <returns></returns>
        public UserControl createUC(UserControl uc)
        {
            UcInstance = getInstanceUC(uc);
            UcInstance.Dock = DockStyle.Fill;
            return UcInstance;
        }
    }
}
